package com.catazzz.springbootstudy.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @作者: Tao
 * @日期: 2025/1/7
 * @时间: 14:14
 * @描述: Redis控制器 <br><pre>
 */
@Slf4j
@RestController
@RequestMapping("/redis")
public class RedisController {

//    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    @RequestMapping("/hello")
    public String hello(){
        stringRedisTemplate.opsForValue().set("hello","world");
        return stringRedisTemplate.opsForValue().get("hello");
    }
}
